/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diana
 */
@Entity
@Table(name = "libranza", catalog = "nomina", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Libranza.findAll", query = "SELECT l FROM Libranza l"),
    @NamedQuery(name = "Libranza.findByIdlibranza", query = "SELECT l FROM Libranza l WHERE l.idlibranza = :idlibranza"),
    @NamedQuery(name = "Libranza.findByValorAbono", query = "SELECT l FROM Libranza l WHERE l.valorAbono = :valorAbono")})
public class Libranza implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idlibranza")
    private Integer idlibranza;
    @Basic(optional = false)
    @Column(name = "valorAbono")
    private float valorAbono;
    @JoinColumn(name = "deuda_iddeuda", referencedColumnName = "iddeuda")
    @ManyToOne(optional = false)
    private Deuda deudaIddeuda;
    @JoinColumn(name = "detallenomina_iddetallenomina", referencedColumnName = "iddetallenomina")
    @ManyToOne(optional = false)
    private Detallenomina detallenominaIddetallenomina;

    public Libranza() {
    }

    public Libranza(Integer idlibranza) {
        this.idlibranza = idlibranza;
    }

    public Libranza(Integer idlibranza, float valorAbono) {
        this.idlibranza = idlibranza;
        this.valorAbono = valorAbono;
    }

    public Integer getIdlibranza() {
        return idlibranza;
    }

    public void setIdlibranza(Integer idlibranza) {
        this.idlibranza = idlibranza;
    }

    public float getValorAbono() {
        return valorAbono;
    }

    public void setValorAbono(float valorAbono) {
        this.valorAbono = valorAbono;
    }

    public Deuda getDeudaIddeuda() {
        return deudaIddeuda;
    }

    public void setDeudaIddeuda(Deuda deudaIddeuda) {
        this.deudaIddeuda = deudaIddeuda;
    }

    public Detallenomina getDetallenominaIddetallenomina() {
        return detallenominaIddetallenomina;
    }

    public void setDetallenominaIddetallenomina(Detallenomina detallenominaIddetallenomina) {
        this.detallenominaIddetallenomina = detallenominaIddetallenomina;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idlibranza != null ? idlibranza.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Libranza)) {
            return false;
        }
        Libranza other = (Libranza) object;
        if ((this.idlibranza == null && other.idlibranza != null) || (this.idlibranza != null && !this.idlibranza.equals(other.idlibranza))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Libranza[ idlibranza=" + idlibranza + " ]";
    }
    
}
